package com.fengplus.demo.config;

import com.fengplus.demo.filter.FilterD;
import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class GatewayConfig {

    @Bean
    public RouteLocator routeD(RouteLocatorBuilder routeLocatorBuilder) {
        return routeLocatorBuilder.routes()
            .route(
                "provider_routh_d",
                r -> r.path("/gateway/d/**")
                    .filters(
                        f -> f.filter(new FilterD()
                    )
                )
                .uri("lb://eureka-provider-service")
            ).build();
    }

}
